// 导入数据库操作模块
const db = require('../db/index')
const axios = require('axios')

//  登录接口处理函数
exports.login = (req,res) => {
    // console.log(req.body.code);
    //请求获取openid
    const code = req.query.code; // 获取小程序传来的code
    const appid = 'wxa89ea9e00bbbbe7b'; // 小程序的appid
    const secret = '1c7989285eb4ae42d70f3724c10c4dc0'; // 小程序的secret
    const url = `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`;

    axios.get(url).then(res=>{
        console.log(res)
    })
}

